import React, { Component } from 'react'

import './index.scss'
export default class TableBody extends Component {
    onStatusClick(cid,index){
        this.props.onStatusClick(cid,index)
    }
  
    render() {
        const {studentData} = this.props;
        return (
            <tbody>
                {
                    studentData.map((item,index)=>{
                        return(
                            <tr key={index}>
                                <td>{item.tid}</td>
                                <td className="img-td">
                                    <a href={item.href} target="_blank"  rel="noopener noreferrer">
                                        <img className="teacher-img"
                                            src={`http://qexgb3yqx.hn-bkt.clouddn.com/${item.teacherImgKey}`}
                                            alt={item.teacherName}
                                        ></img>
                                    </a>
                                </td>
                                
                                <td>{item.teacherName}</td>
                                <td>{item.courseCount}</td>
                                <td>{item.studentCount}</td>
                                <td className="intro-td">{item.intro}</td>
                               
                                <td>
                                    <button className={['btn',item.isStar ? 'btn-danger':'btn-success'].join(' ')}
                                    onClick={this.onStarClick.bind(this,item.tid,index)}>
                                    {item.isStar === 0 ? '上线明星 ': '下线明星'}
                                    </button>
                                </td>
                                <td>
                                    <button className={['btn',item.status ? 'btn-danger':'btn-success'].join(' ')}
                                    onClick={this.onStatusClick.bind(this,item.tid,index)}>
                                    {item.status === 0 ? '上线' : '下线'}
                                       
                                    </button>
                                </td>
                            </tr>
                        )
                    })
                }
            </tbody>
        )
    }
}
